package tech.aistar.day07;

/**
 * 本类用来演示:
 *
 * @author: success
 * @date: 2022/7/26 9:30 上午
 */
public class BookTest {
    public static void main(String[] args) {
        Book b1 = new Book(1,"等一个人的咖啡",100.0d);
        BookInfo info1 = new BookInfo(100,"九把刀");
        b1.setBookInfo(info1);


        Book b2 = new Book(1,"等两个人的咖啡",200.0d);
        BookInfo info2 = new BookInfo(100,"james");
        b2.setBookInfo(info2);

        System.out.println(b1==b2);//false

        System.out.println(b1.equals(b2));//true

        //类型一致性判断
        System.out.println(b1.getClass());//class tech.aistar.day07.Book
        System.out.println(b1.getClass() == b2.getClass());//true

        String s1 = new String("abc");
        String s2 = new String("abc");
        System.out.println(s1 == s2);//false
        System.out.println(s1.equals(s2));//true

        System.out.println(b1.equals(b2));
    }
}
